package org.example.bean.entity.order;

import com.bianmaba.spring.data.jpa.domain.annotations.QueryCacheable;
import com.bianmaba.spring.data.jpa.domain.entity.BaseEntity;
import lombok.Data;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

@DynamicUpdate(true)
@DynamicInsert(true)
@Entity
@Table(name = "[order]")
//此注解重新定义为是否开启查询缓存
@QueryCacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "Order")
@Data
public class Order extends BaseEntity {
    @Column(nullable = false)
    private String number;
    @Column(nullable = false)
    private Double total;
}
